A simple pytest
clone for Rust
rstest
use procedural macro to implement simple fixtures and table based tests.
To use it you need at least 1.30 toolchain (beta channel till 2018-10-25)
and add follow lines to your Cargo.toml
file:
[dev-dependencies]
rstest = "0.2"
The core idea is that every input arguments of your test function will
be resolved by call a function with the same name. You can also use
mut
argument or generic types.
Example:
extern crate rstest;
use rstest;
Moreover you can use rstest_parametrize
attribute to implement table
based tests. An example is the best way to explain it
extern crate rstest;
use rstest_parametrize;
You can find more examples in resources
directory and in rs8080
that use this module intensely.
License
Licensed under either of
-
Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.